﻿/**	@file		lolix_plugin_auto_release_lib.inl
 *	@date		(2013-03-17 18:25:31)/(2013-03-17 18:25:32)
 *-----------------------------------------------------------------------------
 *	@version	1.0.1.1
 *	@author		Nick Shallery	(nicknide@gmail.com)
 *	@copyright	YOU HAVE ALL LEFT WITH THIS CODE WHILE YOU KEEP COMMENT IN EVERY COPY.
 *-----------------------------------------------------------------------------
**/

#if			!defined(__LOLIX__IMP__LOLIX_PLUGIN_AUTO_RELEASE_LIB__INL__NICK__K_IN_G__)
#define		__LOLIX__IMP__LOLIX_PLUGIN_AUTO_RELEASE_LIB__INL__NICK__K_IN_G__

#if			!defined(__LOLIX__LOLIX_ERR__K_IN_G__)
	#include	"../lolix_err.h"
#endif	//	!defined(__LOLIX__LOLIX_ERR__K_IN_G__)

#if			!defined(__LOLIX__LOLIX_INSTANCE__K_IN_G__)
	#include	"../lolix_inst.h"
#endif	//	!defined(__LOLIX__LOLIX_INSTANCE__K_IN_G__)

#if			!defined(__LOLIX__LOLIX_TYPE__K_IN_G__)
	#include	"../lolix_type.h"
#endif	//	!defined(__LOLIX__LOLIX_TYPE__K_IN_G__)

#if			!defined(__LOLIX_IMP__LOLIX_LOCK_OPT__H__NICK__K_IN_G__)
	#include	"./lolix_lock_opt.h"
#endif	//	!defined(__LOLIX_IMP__LOLIX_LOCK_OPT__H__NICK__K_IN_G__)

namespace{
	long	g_auto_release_lib_useage_count = 0;
}

namespace lolix{namespace imp{
	void	plugin_auto_release_lib_inc_ref(void)
	{
		lock_inc(&g_auto_release_lib_useage_count);
	}

	void	plugin_auto_release_lib_release(void)
	{
		lock_dec(&g_auto_release_lib_useage_count);
	}

	lolix::LOLIX_RETNV plugin_auto_release_lib_query(lolix::lolix_inst*)
	{
		if ( !g_auto_release_lib_useage_count )
			return LOLIX_RETNV_OK;
		return LOLIX_ERROR_COMPONT_IS_BUSY;
	}
}}

#endif	//	!defined(__LOLIX__IMP__LOLIX_PLUGIN_AUTO_RELEASE_LIB__INL__NICK__K_IN_G__)
